<template>
	<view class="content">
		<view class="UserHeaders">
			<view class="u_flex">
				<u--image :showLoading="true" :src="info.avatar" width="138rpx" height="138rpx" radius="0"
					shape="circle"></u--image>
				<view class="userRight">
					<text class="name">{{info.name || ''}}</text>
					<view class="view">
						<u--image :showLoading="true" src="../../../static/Mine/phone.png" width="20rpx" height="20rpx"
							radius="0"></u--image>
						<text>{{info.mobile || ''}}</text>
					</view>
					<text class="level">目前英语级别：PreAI</text>
				</view>
			</view>
			<view class="edit_Userinfo">修改资料</view>
		</view>
		<view class="info_Flex">
			<view>
				<text class="num">{{info.class_num || 0}}</text>
				<text class="title">累计上课次数</text>
			</view>
			<view>
				<text class="num">{{info.comment_num || 0}}</text>
				<text class="title">课程报告</text>
			</view>
			<view>
				<text class="num">{{info.course_report_num || 0}}</text>
				<text class="title">累计评价次数</text>
			</view>
		</view>

		<view class="menusBody">
			<view v-for="(item,index) in nav" :key="index" class="ViewFlex"
				:style="{'border-bottom':index !== 4 ? '1px solid #F2F2F2' : '1px solid #fff'}" @click="linkUrl(item.url)">
				<view class="View">
					<u--image :showLoading="true" :src="item.icon" width="48rpx" height="48rpx"
						radius="0"></u--image>
					<text>{{item.name}}</text>
				</view>
				<u--image :showLoading="true" src="../../../static/more.png" width="28rpx" height="28rpx"
					radius="0"></u--image>
			</view>
		</view>

		<view class="menusBody">
			<view v-for="(item,index) in nav2" :key="index" class="ViewFlex"
				:style="{'border-bottom':index !== 2 ? '1px solid #F2F2F2' : '1px solid #fff'}" @click="linkUrl(item.url)">
				<view class="View">
					<u--image :showLoading="true" :src="item.icon" width="48rpx" height="48rpx"
						radius="0"></u--image>
					<text>{{item.name}}</text>
				</view>
				<u--image :showLoading="true" src="../../../static/more.png" width="28rpx" height="28rpx"
					radius="0"></u--image>
			</view>
		</view>

	</view>
</template>

<script>
	import {userinfo} from '../../../api/Mine.js';
	export default {
		data() {
			return {
				nav: [{
					icon:'../../../static/Mine/mine_yuyue.png',
					url: '/pages/Mine/Schedule_courses',
					name: '我的预约课程'
				}, {
					icon:'../../../static/Mine/mine_kec.png',
					url: '/pages/Mine/MyFixedcourses',
					name: '我的固定课程'
				}, {
					icon:'../../../static/Mine/mine_keqian.png',
					url: '',
					name: '我的课前预习'
				}, {
					icon:'../../../static/Mine/mine_dianzan.png',
					url: '/pages/Mine/MyCollectTeacher',
					name: '我的收藏老师'
				}, {
					icon:'../../../static/Mine/mine_lianxilaoshi.png',
					url: '',
					name: '联系老师'
				}],
				nav2: [{
					icon:'../../../static/Mine/mine_vip.png',
					url: '/pages/Mine/MyVip',
					name: '我的会员卡'
				}, {
					icon:'../../../static/Mine/mine_tguang.png',
					url: '/pages/Mine/MyPromotion/Promotion_Center',
					name: '推广中心'
				}, {
					icon:'../../../static/Mine/mine_shezhi.png',
					url: '/pages/Mine/setup',
					name: '设置'
				}],
				info:{}
			}
		},
		onShow(){
			this.userinfo();
		},
		methods:{
			/**
			@method 老师详情
			**/
			async userinfo() {
				try {
					const res = await userinfo();
					this.info = res.data.userinfo;
				} catch (err) {
					//TODO handle the exception
					console.log(err);
				}
			},
			linkUrl(e){
				uni.navigateTo({
					url:e
				});
			}
		}
	}
</script>

<style>
	page {
		background-color: #f7f7f7;
	}
</style>
<style scoped lang="scss">
	.content {
		width: 100%;
		height: 30vh;
		background: linear-gradient(182deg, #EDF6FD 0%, #C8EEFD 0%, #f7f7f7 72%, #f7f7f7 100%);
		position: relative;

		.UserHeaders {
			width: auto;
			padding: 90rpx 0rpx 40rpx 50rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.u_flex {
				width: auto;
				display: flex;
				align-items: center;
			}

			.userRight {
				margin-left: 30rpx;

				.name {
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					font-size: 36rpx;
					color: #202020;
				}

				.view {
					display: flex;
					align-items: center;

					text {
						margin-left: 5rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: #8E8F8E;
					}
				}

				.level {
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #8E8F8E;
				}
			}

			.edit_Userinfo {
				width: 156rpx;
				height: 63rpx;
				padding-left: 10rpx;
				border-top-left-radius: 50rpx;
				border-bottom-left-radius: 50rpx;
				background-color: #277ffe;
				color: #fff;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 26rpx;
				letter-spacing: 2rpx;
			}
		}

		.info_Flex {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 10rpx 50rpx 30rpx 50rpx;

			view {
				text {
					display: block;
					text-align: center;
					margin-top: 10rpx;
				}

				.title {
					font-family: PingFangSC, PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #202020;
				}

				.num {
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					font-size: 36rpx;
					color: #202020;
				}
			}
		}

		.menusBody {
			width: 85%;
			margin: 0px auto;
			padding: 30rpx 30rpx 0rpx 30rpx;
			background-color: #fff;
			border-radius: 20rpx;
			margin-top: 20rpx;

			.ViewFlex {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 30rpx;
				padding-bottom: 30rpx;

				.View {
					display: flex;
					align-items: center;

					text {
						margin-left: 10rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						font-size: 28rpx;
						color: #202020;
					}
				}
			}
		}
	}
</style>